{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "defaultdict(<class 'list'>, {'fruits': ['apple', 'banana'], 'vegetables': ['carrot']})\n",
      "[]\n"
     ]
    }
   ],
   "source": [
    "from collections import defaultdict\n",
    "\n",
    "# Create a defaultdict with list as default factory\n",
    "dd = defaultdict(list)\n",
    "\n",
    "# Adding items\n",
    "dd['fruits'].append('apple')\n",
    "dd['fruits'].append('banana')\n",
    "dd['vegetables'].append('carrot')\n",
    "\n",
    "print(dd)\n",
    "# defaultdict(<class 'list'>, {'fruits': ['apple', 'banana'], 'vegetables': ['carrot']})\n",
    "\n",
    "# Accessing a non-existent key creates an empty list\n",
    "print(dd['meats'])  # []"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "START = 74\n",
    "END = 75\n",
    "\n",
    "# 枚举出db文件路径\n",
    "rng = range(START, END + 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "\n",
    "\n",
    "text=r\"\"\"\n",
    "<h2>Description</h2> <p><strong><span>Pressurized Sprayer Kit includes:</span></strong></p><h4>1x &#8211; Garden Hose Thread EPDM Spray Hose</h4><h4>1x &#8211; Stainless Steel Spray Nozzle</h4><h4>1x &#8211; 5500 Series – Pressure Pump </h4><h4>1x &#8211; Storage Tank to 5500 Series Sprayer Kit</h4> <br><p><strong>This Pressurized Sprayer Kit includes everything needed to easily connect to any clean water reservoir for ideal pressurized spraying. This kit uses all FDA / USDA sanitary and food safe components specifically designed for the use of clean potable water. This kit is a hashers best friend!</strong></p> <p><strong>The optional <span>Pump Strainer</span> goes before the pump and has a stainless steel mesh screen inside of it that will prevent any possible unwanted debris from going into the pump or spray water. </strong></p> <p><strong>The optional </strong><strong><span>Swivel Adapter</span> is for the stainless steel nozzle and allows for a free motion swivel which will help prevent kinks in the hose. it also has a locking ring which allows you to lock the nozzle in place at your desire spray rate.</strong></p> <p><strong>You can purchase the kit with an <span>assembled</span> Storage Tank to 5500 Series Sprayer Kit in which we glue the pieces for you, or you can buy the kit <span>unassembled</span> and glue the pieces yourself. Assembly for the rest of the kit is still <span>required</span>.</strong></p> <p><strong>*A 1-3/8in to 1-1/2in Hole Size is required for the bulkhead installation*</strong></p>\n",
    "\"\"\"\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "text=r\"\"\"\n",
    "<p><strong><span style=\"text-decoration: underline;\">Pressurized Sprayer Kit includes:</span></strong></p><h4 class=\"wp-block-heading\">1x &#8211; <a href=\"http://windycitywatertreatment.com/product/sanitary-spray-hose/\">Garden Hose Thread EPDM Spray Hose</a></h4><h4 class=\"wp-block-heading\">1x &#8211; <a href=\"http://windycitywatertreatment.com/product/stainless-steel-spray-nozzle/\">Stainless Steel Spray Nozzle</a></h4><h4 class=\"wp-block-heading\">1x &#8211; <a href=\"http://windycitywatertreatment.com/product/spraypump/\">5500 Series – Pressure Pump </a></h4><h4 class=\"wp-block-heading\">1x &#8211; <a href=\"http://windycitywatertreatment.com/product/reservoir-to-pump-sprayer-kit/\">Storage Tank to 5500 Series Sprayer Kit</a></h4>\t\t\t</br>\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import re\n",
    "def remove_sensitive_info(text):\n",
    "    \"\"\"移除文本中的敏感信息，如邮箱地址、网址、电话号码等\"\"\"\n",
    "    # 移除邮箱地址\n",
    "    text = re.sub(r\"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\", \"\", text)\n",
    "\n",
    "    # 移除HTTP(S)链接\n",
    "    text = re.sub(r\"https?://[^\\s]+/\", \"\", text)\n",
    "\n",
    "    # 移除纯域名\n",
    "    text = re.sub(r\"\\b(?:www\\.)?[a-zA-Z0-9-]+\\.[a-zA-Z]{2,}(?:/[^\\s]*)?\", \"\", text)\n",
    "\n",
    "\n",
    "\n",
    "    return text"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "<p><strong><span style=\"text-decoration: underline;\">Pressurized Sprayer Kit includes:</span></strong></p><h4 class=\"wp-block-heading\">1x &#8211; <a href=\"\">Garden Hose Thread EPDM Spray Hose</a></h4><h4 class=\"wp-block-heading\">1x &#8211; <a href=\"\">Stainless Steel Spray Nozzle</a></h4><h4 class=\"wp-block-heading\">1x &#8211; <a href=\"\">5500 Series – Pressure Pump </a></h4><h4 class=\"wp-block-heading\">1x &#8211; <a href=\"\">Storage Tank to 5500 Series Sprayer Kit</a></h4>\t\t\t</br>\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(remove_sensitive_info(text))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "\n",
    "\n",
    "text=\"\"\"\n",
    "<h2>Description</h2> <p><strong><span>Pressurized Sprayer Kit includes:</span></strong></p><h4>1x &#8211; Garden Hose Thread EPDM Spray Hose</h4><h4>1x &#8211; Stainless Steel Spray Nozzle</h4><h4>1x &#8211; 5500 Series – Pressure Pump </h4><h4>1x &#8211; Storage Tank to 5500 Series Sprayer Kit</h4> <br><p><strong>This Pressurized Sprayer Kit includes everything needed to easily connect to any clean water reservoir for ideal pressurized spraying. This kit uses all FDA / USDA sanitary and food safe components specifically designed for the use of clean potable water. This kit is a hashers best friend!</strong></p> <p><strong>The optional <span>Pump Strainer</span> goes before the pump and has a stainless steel mesh screen inside of it that will prevent any possible unwanted debris from going into the pump or spray water. </strong></p> <p><strong>The optional </strong><strong><span>Swivel Adapter</span> is for the stainless steel nozzle and allows for a free motion swivel which will help prevent kinks in the hose. it also has a locking ring which allows you to lock the nozzle in place at your desire spray rate.</strong></p> <p><strong>You can purchase the kit with an <span>assembled</span> Storage Tank to 5500 Series Sprayer Kit in which we glue the pieces for you, or you can buy the kit <span>unassembled</span> and glue the pieces yourself. Assembly for the rest of the kit is still <span>required</span>.</strong></p> <p><strong>*A 1-3/8in to 1-1/2in Hole Size is required for the bulkhead installation*</strong></p>\n",
    "\"\"\"\n",
    "\n",
    "\"\"\"\n",
    "<h2>Description</h2> <p><strong><span>Pressurized Sprayer Kit includes:</span></strong></p><h4>1x &#8211; Garden Hose Thread EPDM Spray Hose</h4><h4>1x &#8211; Stainless Steel Spray Nozzle</h4><h4>1x &#8211; 5500 Series – Pressure Pump </h4><h4>1x &#8211; Storage Tank to 5500 Series Sprayer Kit</h4> <br><p><strong>This Pressurized Sprayer Kit includes everything needed to easily connect to any clean water reservoir for ideal pressurized spraying. This kit uses all FDA / USDA sanitary and food safe components specifically designed for the use of clean potable water. This kit is a hashers best friend!</strong></p> <p><strong>The optional <span>Pump Strainer</span> goes before the pump and has a stainless steel mesh screen inside of it that will prevent any possible unwanted debris from going into the pump or spray water. </strong></p> <p><strong>The optional </strong><strong><span>Swivel Adapter</span> is for the stainless steel nozzle and allows for a free motion swivel which will help prevent kinks in the hose. it also has a locking ring which allows you to lock the nozzle in place at your desire spray rate.</strong></p> <p><strong>You can purchase the kit with an <span>assembled</span> Storage Tank to 5500 Series Sprayer Kit in which we glue the pieces for you, or you can buy the kit <span>unassembled</span> and glue the pieces yourself. Assembly for the rest of the kit is still <span>required</span>.</strong></p> <p><strong>*A 1-3/8in to 1-1/2in Hole Size is required for the bulkhead installation*</strong></p>\n",
    "\"\"\"\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
